Skip to content

Replace AutoMapper with Mapperly #1206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
neva1842 opened this issue Jul 29, 2024 · 3 comments
Open

Replace AutoMapper with Mapperly #1206

neva1842 opened this issue Jul 29, 2024 · 3 comments

Comments

@neva1842
Copy link

Is your feature request related to a problem? Please describe.
This feature request is not related to a problem. It is an exploratory idea to consider replacing AutoMapper with Mapperly.

Describe the solution you'd like
I propose considering the replacement of Automapper with Mapperly in Jason Taylor's CleanArchitecture template. According to the benchmarks provided in this GitHub repository, Mapperly demonstrates superior performance compared to Automapper. This enhancement can potentially lead to performance gains in our applications. Moreover, Mapperly supports IQueryable projections, which aligns well with our existing use cases.

@m2017atTR
Copy link

Hi neva1842,

Automapper have support about projection .Project() ...
https://ojdevelops.com/2015/09/using-automapper-in-entity-framework.html

@fizmhd
Copy link

fizmhd commented Sep 23, 2024

Hi,
We have used Mapperly in our project and it was not a good choice.
Its a good library, when the mapping is direct, and simple mappings.

But when your property names are different, then you need to mention it by attributes.
It grows longer, when you have many properties.

When it comes to mapping Child classes, it becomes harder.

So we had to move away from Mapperly, and use simple mapping classes.

Sharing, my feedback on library, I am not against it.

@Kamyab7
Copy link
Contributor

Kamyab7 commented Apr 19, 2025

Hi!

Thank you for bringing this up. In response to the idea of replacing AutoMapper with Mapperly, I've recently made a similar change in this pull request, but for slightly different reasons.

I decided to replace AutoMapper with manual mapping in the project to avoid introducing additional dependencies for a simple task like mapping. This change also came about because AutoMapper has transitioned to a commercial license, and to keep the project fully open-source and free of such dependencies, I opted for manual mappings instead.

While performance considerations are definitely important, manual mapping also offers excellent performance as it avoids the overhead that comes with reflection and the abstraction layer AutoMapper provides. It's a lightweight approach that can perform well even as the size of the data grows, and it gives us full control over the mapping logic, making it easy to optimize for specific cases if needed.

I appreciate the suggestion regarding Mapperly, and it could indeed be a good option in the future if we need specific features that it offers. However, for now, manual mapping serves our purpose well and keeps the codebase simple, clean, and performant.

Feel free to continue the discussion if you think there are other benefits to explore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants